<template>
  <header>
    <div class="l-content">
      <el-button plain icon="el-icon-menu" size="mini" @click="collapseMeun"></el-button>
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <!-- <el-breadcrumb-item :to="{ path: '' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item :to="current.path" v-if="current">{{current.lable}}</el-breadcrumb-item> -->
      </el-breadcrumb>
    </div>
    <div class="r-content">
      <el-dropdown trigger="click" style="color:#fff">
        <span class="el-dropdown-link">
          <img :src="userimg" class="user" />
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item>个人中心</el-dropdown-item>
          <el-dropdown-item @click.native="Lout">退出</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </header>
</template>

<script>
import { mapState } from "vuex";
export default {
  computed: {
    ...mapState({
      current: state => state.tab.currentMenu
    })
  },
  data() {
    return {
      userimg: require("../assets/img/user.png")
    };
  },
  methods: {
    collapseMeun() {
      this.$store.commit("collapseMeun");
    },
    Lout() {
      this.$store.commit("clearToken");
      this.$store.commit("clearMenu");
      //location.reload();
      this.$router.push('/')
    }
  }
};
</script>

<style lang="scss" scoped>
header {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: space-between;
}
.l-content {
  display: flex;
  align-items: center;
  .el-button {
    margin: 20px;
  }
}
.r-content {
  .user {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
  }
}
</style>

<style lang="scss">
.el-breadcrumb__inner {
  color: aliceblue;
}
.el-breadcrumb__item:last-child .el-breadcrumb__inner,
.el-breadcrumb__item:last-child .el-breadcrumb__inner a,
.el-breadcrumb__item:last-child .el-breadcrumb__inner a:hover,
.el-breadcrumb__item:last-child .el-breadcrumb__inner:hover {
  color: aliceblue;
}
.el-breadcrumb__inner a,
.el-breadcrumb__inner.is-link {
  color: aliceblue;
}
</style>